/*
XPTracker - Alternative Agile Tracking Tool
Copyright (C) 2006-2009  Stephen Starkey

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/
package org.xptracker.domain;

import org.xptracker.persistence.Identified;

import javax.persistence.*;

@Entity
@Table(name="wiki_content")
public class WikiContent extends Identified {
  private String content;
  private WikiStyle wikiStyle = WikiStyle.markdown;

  protected WikiContent() {
  }

  public WikiContent(String content) {
    this.content = content;
  }

  public WikiContent(String content, WikiStyle wikiStyle) {
    this.content = content;
    this.wikiStyle = wikiStyle;
  }

  @Lob
  @Column(length = 65535)
  public String getContent() {
    return content == null ? "" : content;
  }

  public void setContent(String content) {
    this.content = content;
  }

  @Column(name="wiki_style")
  @Enumerated(EnumType.STRING)
  public WikiStyle getWikiStyle() {
    return wikiStyle;
  }

  public void setWikiStyle(WikiStyle wikiStyle) {
    this.wikiStyle = wikiStyle;
  }
}
